// To parse this JSON data, do
//
//     final loginData = loginDataFromJson(jsonString);

import 'dart:convert';

import 'package:demo/common/net/converters/safe_int_converter.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'login_data.freezed.dart';
part 'login_data.g.dart';

LoginData loginDataFromJson(String str) => LoginData.fromJson(json.decode(str));

String loginDataToJson(LoginData data) => json.encode(data.toJson());

@freezed
abstract class LoginData with _$LoginData {
  const factory LoginData({
    @JsonKey(name: "yonghu_id")
    required int yonghuId,
    @JsonKey(name: "pingju")
    required String pingju,
    @JsonKey(name: "xinyonghu")
    @SafeIntConverter()
    required int xinyonghu,
  }) = _LoginData;

  factory LoginData.fromJson(Map<String, dynamic> json) => _$LoginDataFromJson(json);
}
